﻿//AcademicPlanner - course registration planning web app.
//Copyright (C) 2009  Boubacar Diallo

//This program is free software; you can redistribute it and/or
//modify it under the terms of the GNU General Public License
//as published by the Free Software Foundation; either version 2
//of the License, or (at your option) any later version.

//This program is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//GNU General Public License for more details.

//You should have received a copy of the GNU General Public License
//along with this program; if not, write to the Free Software
//Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.


using System;
using AcademicPlanner.Domain.Components;
using AcademicPlanner.Domain.Models;
using AcademicPlanner.Data;

namespace AcademicPlanner.Domain
{
	/// <summary>
	/// DomainMaster is the front controller singleton of the domain layer of the
	/// AcademicPlanner application.
	/// </summary>
	/// <since>1.0</since>
	public class DomainMaster
	{
		/// <summary>
		/// Gets the <c>DataSourceAccessSupervisor</c> of the data layer.
		/// </summary>
		/// <since>1.0</since>
		internal DataSourceAccessSupervisor DSAS { get { return DataSourceAccessSupervisor.GetInstance(); } }

		/// <summary>
		/// Gets the <c>AuthMngr</c> component of the AcademicPlanner application.
		/// </summary>
		/// <since>1.0</since>
		public AuthMngr Auth { get { return AuthMngr.GetInstance(); } }

		/// <summary>
		/// Gets the <c>MembershipMngr</c> component of the AcademicPlanner application.
		/// </summary>
		/// <since>1.0</since>
		public MembershipMngr Membership { get { return MembershipMngr.GetInstance(); } }

		/// <summary>
		/// Gets the <c>AcademicPlanningMngr</c> component of the application.
		/// </summary>
		/// <since>1.0</since>
		public AcademicPlanningMngr Planning { get { return AcademicPlanningMngr.GetInstance(); } }

		/// <summary>
		/// Gets the <c>AcademicSchedulingMngr</c> component of the application.
		/// </summary>
		/// <since>1.0</since>
		public AcademicSchedulingMngr Scheduling { get { return AcademicSchedulingMngr.GetInstance(); } }

		/// <summary>
		/// Gets the <c>ModelsFountain</c> of the AcademicPlanner application.
		/// </summary>
		/// <since>1.0</since>
		internal ModelsFountain ModelsFountain { get { return ModelsFountain.GetInstance(); } }

		/// <summary>
		/// Gets the <c>MainModel</c> of the AcademicPlanner application.
		/// </summary>
		/// <since>1.0</since>
		internal MainModel MainModel { get { return MainModel.GetInstance(); } }


		private DomainMaster() 
		{
			
		}

		private class InstanceHolder 
		{
			internal static DomainMaster INSTANCE = new DomainMaster(); 
		}


		/// <summary>
		/// Gets the single DomainMaster instance.
		/// </summary>
		/// <returns>The single DomainMaster instance.</returns>
		/// <since>1.0</since>
		public static DomainMaster GetInstance()
		{ 
			return InstanceHolder.INSTANCE; 
		}
	}
}
